<script type="text/javascript">
$(function () {
    // 链接二维码
    $(".preview_url").mouseover(function(e) {
      var encodeurl = "{$_W['siteroot']}" + $(this).attr("href").replace(/&/g, "%26");
      var qrcodeimg = "<div id='qrcodeimg'><img src='http://qr.liantu.com/api.php?w=200&text=" + encodeurl + "' width='300' alt='二维码'/><\/div>";
      $("body").append(qrcodeimg); //把它追加到文档中
      $("#qrcodeimg")
      .css({
        "z-index": 9999,
        "position" : "absolute",
        "top": (e.pageY + 10) + "px",
        "left": (e.pageX + 10) + "px"
        }).show("fast");   //设置x坐标和y坐标，并且显示
      }).mouseout(function () {
        $("#qrcodeimg").remove();  //移除
        }).mousemove(function (e) {
          $("#qrcodeimg").css({
        "z-index": 9999,
        "position" : "absolute",
        "top": (e.pageY + 10) + "px",
        "left": (e.pageX + 10) + "px"
        });   //设置x坐标和y坐标，并且显示
      });

    // 预览图
    var x = 10;
    var y = 20;
    $(".showTip").mouseover(function (e) {
        this.myTitle = this.title;
        this.title = "";
        var imgtip = "<div id='showTip'><img src='" + $(this).attr("bigimg") + "' width='300' alt='预览图'/><\/div>"; //创建 div 元素
        $("body").append(imgtip); //把它追加到文档中
        if (e.pageX + 300 > $(window).width()) {
            x = 10;
        } else {
            x = $(window).width() - 310;
        }
        $("#showTip").css({
            "z-index": 9999,
            "position" : "fixed",
            "top": (10) + "px",
            "left": x + "px"
        }).show("fast");   //设置x坐标和y坐标，并且显示
        }).mouseout(function () {
                this.title = this.myTitle;
                $("#showTip").remove();  //移除
        }).mousemove(function (e) {
            $("#showTip").css({
                "z-index": 9999,
                "position" : "fixed",
                "top": (10) + "px",
                "left": x + "px"
            });
    });

    $(".template_picker").click(function(e) {
        $(this).find('input').attr('checked', 'checked');
        });
});
</script>
